// frontend/src/main.js
import { createApp } from 'vue'
import App from './App.vue'

// 1. 导入 Element Plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

// 2. 导入路由 (P4 稍后创建)
import router from './router'

// 3. 导入 Pinia (P4 创建, P5 使用)
import { createPinia } from 'pinia'
const pinia = createPinia()

// 4. (可选) 导入 Element Plus 图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)

// 注册所有 Element Plus 图标 (P4/P5 可选)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 5. 启用插件
app.use(pinia)
app.use(router)
app.use(ElementPlus)

// 6. 挂载
app.mount('#app')